
import wx from "weixin-jsapi";

const wxUtils = () => {
    return new Promise((resolve, reject) => {
      getJSSDK().then(async data => {
        await wx.config({
            debug:false,
            appid: "wx2d03a7c98381ec0c",
            noncestr: "szrq",
            signature: "4ECD8F328FD68F7E708BB824B9460BB0EF3C643C",
          jsApiList: [
            'getLocation',
            'hideMenuItems'
          ]
        });
        wxReady(resolve)
      }).catch(error => {
        reject();
        console.log(error);
      })
    })
  }

const getLocation = () => {
    return new Promise((resolve, reject) => {
      wx.getLocation({
        type: 'wgs84', // 默认为wgs84的gps坐标，如果要返回直接给openLocation用的火星坐标，可传入'gcj02'
        success: response => {
          resolve(response);
          console.log('cg')
        },
        fail: err => {
          reject(err);
        }
      });
    });
  
}
    export { getLocation };
    export default wxUtils